package cn.net.yugu.doraemon.netty.protocol.msg22;

import cn.net.yugu.doraemon.netty.protocol.MsgCode;
import io.netty.buffer.ByteBuf;

/**
 * 心跳
 */
public class Msg221000010 extends Msg221 {

    public static final byte LIVE_ONLINE = 1;
    public static final byte LIVE_OFFLINE = 0;

    public static final byte CLIENT_TYPE_EXCHANGE_SERVER = 1;

    public byte clientType;
    public String clientId;
    public byte live;
    public String extra;

    @Override
    public int getMsgCode() {
        return MsgCode.MSG_221000010.getCode();
    }

    @Override
    public void readData(ByteBuf buffer) {
        clientType = buffer.readByte();
        clientId = readString(buffer);
        live = buffer.readByte();
        extra = readString(buffer);
    }

    @Override
    public void writeData(ByteBuf buffer) {
        buffer.writeByte(clientType);
        writeString(buffer, clientId);
        buffer.writeByte(live);
        writeString(buffer, extra);
    }
}
